#!/usr/local/bin/ruby
# Copyright (C) 2003-2010 Wang Pengcheng <wpc0000@gmail.com>
# , released under the MIT license
# You may obtain a template of the MIT License at
# http://www.opensource.org/licenses/mit-license.php
$KCODE = 'utf8'

u = 1.25*10**7
l = 1.0*10**7
K = 10

pro = l/u
puts 'System Utilisation:'+pro.to_s

def N(pro, k)
  pro/(1-pro) -(k+1)*pro**(k+1)/(1-pro**(k+1))
end

def leff(l, pro, k)
 l*(1-(1-pro)*pro**k/(1-pro**(k+1)))
end

def T(n,l)
  n/l
end

n = N(pro, K)
le = leff(l, pro, K)
puts 'The mean delay time:'+T(n,le).to_s

def pk(pro,k)
  (1-pro)*pro**k/(1-pro**(k+1))
end

puts 'The pk:'+pk(pro, K).to_s
